package com.spring.boot.demo.config;

import com.spring.boot.demo.interceptor.CorsInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author ZhuYouBin
 * @version 1.0.0
 * @Date: 2022/11/1 22:03
 * @Description
 */
@Configuration
public class CustomWebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器
        registry.addInterceptor(new CorsInterceptor())
                .addPathPatterns("/**");
    }
}
